﻿namespace UnityEditor
{
    using System;
    using UnityEngine;

    internal class MoveTool
    {
        public static void OnGUI()
        {
            if ((Selection.activeTransform != null) && !Tools.s_Hidden)
            {
                Vector3 handlePosition = Tools.handlePosition;
                Undo.SetSnapshotTarget(Selection.transforms, "Move " + ((Selection.transforms.Length != 1) ? string.Empty : Selection.activeGameObject.name));
                Vector3 vector2 = Handles.PositionHandle(handlePosition, Tools.handleRotation);
                if (GUI.changed)
                {
                    Vector3 vector3 = vector2 - handlePosition;
                    foreach (Transform transform in Selection.transforms)
                    {
                        transform.position += vector3;
                    }
                }
            }
        }
    }
}

